// name-generation.service.ts

import { Injectable } from '@nestjs/common';
import axios from 'axios';

const token = "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";

@Injectable()
export class NameGenerationService {
  async generateName(params: any): Promise<string> {
    console.log("这是语料", params)
    const response = await axios.post('http://173.82.227.22:3000/generateName', params, {
        timeout: 99000 // 设置超时时间为 5000 毫秒
    });
    console.log("最终生成的名字", response  )
    return response.data
    // Assuming the name is the last sentence in the response
    // const name = response.data.choices[0].text.trim().split('\n').pop();
    // return response;
  }
}
